package com.candy.dao;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Test01 {
    public static void main(String[] args) {
//        this\super\static\final\abstract\interface\extend
        test04();

    }
    public static void test04() {
//        新增
        try {
            ResultSet re= DBHelper.getInfo("SELECT * FROM logininfo;");
//            遍历查询结果
            while(re.next()){
                  System.out.print(re.getObject(1)+" ");
                  System.out.print(re.getObject(3));
                  System.out.print(re.getObject(2)+" ");
                  System.out.println();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    public static void test01() {
//        新增
        int num=DBHelper.update("INSERT INTO logininfo(username,userpwd) VALUES('张三','123456');");
        System.out.println(num);
    }
    public static void test02() {
//        修改
        int num=DBHelper.update("UPDATE logininfo SET userpwd='166666' WHERE id=17;");
        System.out.println(num);
    }
    public static void test03() {
//        删除
        int num=DBHelper.update("delete from logininfo WHERE id=17;");
        System.out.println(num);
    }
}
